package com.xiaoming.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.xiaoming.dao.ArticleMapper;
import com.xiaoming.pojo.Article;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ArticleService {
    @Autowired
    private ArticleMapper articleMapper;

    public PageInfo<Article> findAll(Integer pageNo, Integer pageSize) {
        PageHelper.startPage(pageNo, pageSize);
        List<Article> articles = articleMapper.findAll();
        PageInfo<Article> result = new PageInfo<>(articles);
        return result;
    }
}
